home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_477 / irmaster / letgo.asm < prev    next >
Assembly Source File  |  1992-05-06  |  1KB  |  54 lines

  1. ;
  2. ; LetGo.asm
  3. ;
  4. ; Reads from parallel port until detects a quiescent state.
  5. ;
  6.         csect text
  7.  
  8.     xdef _LetGo
  9.  
  10.         xref _ciab
  11.         xref _NSamples
  12.  
  13.         xref _Forbid
  14.         xref _Disable
  15.         xref _Enable
  16.         xref _Permit
  17.  
  18. data1             equ   $bfe101
  19. dir1              equ   $bfe301
  20.  
  21. _LetGo
  22. ;
  23. ; Save registers on stack.
  24. ;
  25.          MOVEM.L A2-A6/D2-D7,-(SP)  ;  Push Registers 
  26. ;
  27. ; Set up parallel port for reading.
  28. ;
  29.          move.b   #0,dir1           * all lines read
  30.          move.b   #0,data1
  31. ;
  32. ; Read from parallel port until see no change for 10000 cycles.
  33. ;
  34. again:  move.l   #$2710,_NSamples  ; Initialize the counter to BIG.
  35.                                    ; FFF0 * .1397us/clock * 50 clocks = .5sec
  36.         move.l   #0,d1             ; Zero the detection flag.
  37.  
  38. loop:   move.b   data1,d0          ; Move byte from parallel port to buffer.
  39.         andi.b   #1,d0             ; Mask off bit of interest.
  40.         bne      over
  41.         addq.l   #$1,d1            ; Found a zero = still getting signal.
  42. over:   subq.l   #$1,_NSamples     ; Decrement counter.
  43.         bne      loop              ; Loop if haven't done 10000 yet.
  44.  
  45.         tst.l    d1                ; Still receiving signal?
  46.         bne      again
  47. ;
  48. ; Clean up, restore registers and return.
  49. ;
  50.         MOVEM.L (SP)+,A2-A6/D2-D7  ;  Pop Registers
  51.         RTS
  52.  
  53.         END
  54.